package com.wenlong.agricultural.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wenlong.agricultural.pojo.CommodityInfo;
import com.wenlong.agricultural.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 苏文龙
 * @version 1.0
 */
@Controller
@RequestMapping("/agricultural")
public class IndexController {

    @Autowired
    private CommodityService commodityService;

    @RequestMapping(value = {"/toDetailPage"})
    public String toDetailPage(Model model){
        QueryWrapper<CommodityInfo> query = new QueryWrapper<>();
        query.like("commod_name", "洛川苹果");
        CommodityInfo commodity = commodityService.getOne(query);
        model.addAttribute("commodity", commodity);
        return "showDetail";
    }
}
